#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int digitsum(int n)
{
	int a = n / 1000;
	int b = n / 100 % 10;
	int c = n % 100 / 10;
	int d = n % 100 % 10;
	return a + b + c + d;
}
int main()
{
	int n = 0;
	scanf("%d", &n);
	int r = digitsum(n);
	printf("%d",r);

}